<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    // Promise.all([
    //   new Promise((resolve, reject) => {
    //     $.ajax({
    //       url: '',
    //       success: data => {
    //         resolve(data);
    //       }
    //     })
    //   }),
    //   new Promise((resolve, reject) => {
    //     $.ajax({
    //       url: '',
    //       success: data => {
    //         resolve(data);
    //       }
    //     })
    //   })
    // ]).then(res => {
    //   console.log(res);
    // })

    Promise.all([
      new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve({name: '赵毅', age: 20});
        }, 1000)
      }),
      new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve({name: '徐漠', age: 17});
        }, 2000)
      })
    ]).then(res => {
      // res是一个数组，两个promise都执行结束之后得到的结果
      console.log(res);
    })
  </script>
</body>
</html>